﻿namespace EggOfPanKu.Library.Objects
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class CardStack
    {
        #region Fields

        private CardStackType _CardStackType;
        private List<Card> _cards = new List<Card>();

        #endregion Fields

        #region Constructors

        public CardStack(CardStackType cardStackType)
        {
            CardStackType = cardStackType;
        }

        public CardStack(IEnumerable<Card> cardList, CardStackType cardStackType)
        {
            CardStackType = cardStackType;
            Cards.AddRange(cardList);
        }

        #endregion Constructors

        #region Properties

        public CardStackType CardStackType
        {
            get { return _CardStackType; }
            set { _CardStackType = value; }
        }

        public List<Card> Cards
        {
            get
            {
                return _cards;
            }
        }

        #endregion Properties

        #region Methods

        public int GetCardCount(Card searchCard)
        {
            int count = 0;
            foreach (Card card in Cards)
            {
                if (card.CardID == searchCard.CardID)
                {
                    count++;
                }
            }

            return count;
        }

        #endregion Methods
    }
}